﻿using System;
using CtCommon.Utility;
using CtUser.Utility.Validate;

namespace Ct.StudentProject.Myself
{
    public class student
    {
        public string userName { get; set; }
        public string name { get; set; }
        public string IDNumber { get; set; }
        public int Sex { get; set; }
        public string Password { get; set; }

        public student(string usrName, string name, string IDnumber, string Password)
        {
            this.userName = usrName;
            this.name = name;
            this.IDNumber = IDnumber;
            this.Password = Password;
        }
        public bool VerifyInfo(out string errmsg)
        {
            errmsg = "success";
          //  string msg;
            bool isvaild = this.userName.InitValidation().ToNext(this.name.IsNullOrEmptyAndTrim()).IsTrue("nameEmpty")
                     .ToNext(this.userName.IsNullOrEmptyAndTrim()).IsTrue("userNameEmpty")
                    .ToNext(this.IDNumber.IsNullOrEmptyAndTrim()).IsTrue("IDNumberEmpty")
                    .ToNext(!this.name.IsChinese()).IsTrue("nameIsNotChinese")
                    .ToNext(!this.IDNumber.IsIDCard()).IsTrue("errIDcard").End(out string msg);
            errmsg = msg;
            return isvaild;




        }
    }

}

//Dictionary<string, string> dic = new Dictionary<string, string>();
//dic.Add("nameEmpty", "姓名为空");
//        dic.Add("userNameEmpty", "用户名为空");
//        dic.Add("IDNumberEmpty", "身份证不能为空");